package com.example.demo.service;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.example.demo.entity.ParkingLot;
import com.example.demo.mapper.ParkingLotMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service

public class ParkingLotService extends ServiceImpl<ParkingLotMapper, ParkingLot> {
    ParkingLotMapper mapper;
    @Autowired
    ParkingLotService(ParkingLotMapper mapper){

        this.mapper=mapper;
    }

    public List<ParkingLot> getAll(){
        return mapper.getAll();
    }

    public ParkingLot getById(Long id) {
        return mapper.getById(id);
    }

    public boolean insert(ParkingLot entity){
        return mapper.insert(entity) > 0;
    }

    public boolean update(ParkingLot entity){
        return mapper.update(entity) > 0;
    }
    public boolean delete(Long id) {
        int result=mapper.deleteById(id);
        return result > 0;
    }
}
